package com.fengdi.everyday.easy;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;

/**
 * @Description 3289 数字小镇中的捣蛋鬼
 * @Date 09:34
 */
public class GetSneakyNumbers {
    public int[] getSneakyNumbers(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        int[] ans = new int[2];
        int count = 0;

        for(int a : nums) {
            if(count >= 2) break;

            if(set.contains(a)) {
                ans[count] = a;
                count++;
            }else {
                set.add(a);
            }
        }

        return ans;
    }
}
